﻿using DAL;
using FubiManger.UI;
using Smobiler.Core;
using Smobiler.Core.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FubiManger.Pad
{
    ////ToolboxItem用于控制是否添加自定义控件到工具箱，true添加，false不添加
    //[System.ComponentModel.ToolboxItem(true)]
    partial class Pwdcontrol : Smobiler.Core.Controls.MobileUserControl
    {
        public Pwdcontrol() : base()
        {
            //This call is required by the SmobilerUserControl.
            InitializeComponent();
        }
        /// <summary>
        /// 用户ID
        /// </summary>
        public string adminid { get; set; }
        /// <summary>
        /// 关闭
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnclose_Press(object sender, EventArgs e)
        {
            this.Close();

        }

        private void btnsub_Press(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtpwd.Text))
            {
                MessageBox.Show("请输入密码");
            }
            else if (txtpwd.Text.Length < 6)
            {
                MessageBox.Show("密码必须大于6位");
            }
            else if (txtpwd.Text != txtpwd1.Text)
            {
                MessageBox.Show("密码不一致");
            }
            else
            {
                string pwd = AesUtil.EncryptString(txtpwd1.Text);
                if (adminsDal.Updatepwd(pwd, adminid) > 0)
                {
                    Toast("密码修改成功");
                    this.Form.RemoveClientData("merchantid");
                    this.Client.ReStart();
                }
            }
        }
    }
}